import requests 
import json  
import time

# 测试请求 -- 住院查询数据

def main1():

    url1="http://heb.hsip.gov.cn/ims-hb/web/bigdata/inhosp/statistic/getPage"
    token1='946eceb1-3eb0-43f4-be8d-676c070f0b5c'
    session1='NDBmYTAxZDMtNzllMy00YTU0LWJhYzItYTI2MGUxOTk0ZjMx'


    data1={"pageNum":1,"pageSize":5,"order":"","startDate":"2024-05-01",
           "endDate":"2024-05-16","count":None,"countExpr":None,"feeLeft":None,
           "feeRight":None,"psnNo":"","clrOptins":"130534","_modulePartId_":"",
           "frontUrl":f"http://heb.hsip.gov.cn/ims-hb/ui/W0104.html#/W010401?html_no_cache={time.time()}"}
    
    headers1={"Accept":"application/json, text/plain, */*",
              "Accept-Language":"zh-CN,zh;q=0.9",
              'Connection':'keep-alive',
              'Content-Type':'application/json; charset=UTF-8',
              "Cookie":f"XSRF-TOKEN={token1}; SESSION={session1}",
              "Origin":"http://heb.hsip.gov.cn",
              "Referer":"http://heb.hsip.gov.cn/ims-hb/ui/W0104.html",
              "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
              "X-XSRF-TOKEN":f"{token1}"
              }

    resp1=requests.post(url=url1,json=data1,headers=headers1,verify=False)
    if resp1.status_code!=200 :
        print('请求失败，状态为 '+resp1.status_code)
        return
    
    txt1 = resp1.text

    print('+++++++++++++'+txt1)

if __name__ == '__main__':  
    main1()

